<style lang="less" scoped>
@import url('./style.less');
.panel {
  &-content {
    &__item {
      &-label {
        flex: 1;
      }
    }
    &__change {
      background: #f8f8f8;
      flex: 1;
      max-width: 100%;
      display: flex;
      color: #666;
      word-wrap: break-word;
      word-break: break-all;
      font-size: 12px;
      &-before {
        flex: 1;
        padding: 4px;
      }
      &-after {
        flex: 1;
        padding: 4px;
      }
    }
  }
}
</style>
<template>
  <div class="box">
    <div class="box-title" @click="show=!show">
      <div class="box-title__label">股权变更信息</div>
      <div class="box-title__right">
        <span class="num">{{len||'无'}}</span>
        <i v-if="len>0" :class="cls"></i>
      </div>
    </div>
    <div class="box-content" v-show="show">
      <div class="panel" v-for="(item, index) in dt" :key="index">
        <div class="panel-content">
          <div class="panel-content__item">
            <div class="panel-content__item-label">{{item.ChangeDate||'-'}}</div>
            <div class="panel-content__item-right">{{item.Name||'-'}}</div>
          </div>
          <div class="panel-content__item">
            <!-- 记录变更 -->
            <div class="panel-content__change">
              <div class="panel-content__change-before">
                变更前
                <div v-html="item.Before||'-'"></div>
              </div>
              <div class="panel-content__change-after">
                变更后
                <div v-html="item.After||'-'"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ['dt'],
  data() {
    return {
      show: false
    };
  },
  onUnload() {
    this.show = false;
  },
  computed: {
    cls() {
      const arrow = this.show ? 'icon-shangjiantou' : 'icon-tubiaozhizuo-';
      return `iconfont ${arrow}`;
    },
    len() {
      return this.dt.length;
    }
  }
};
</script>
